package com.example.demo.mapper;

import com.example.demo.model.Klass;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface KlassMapper {

//    @Select("select * from klass")
    public List<Klass> findAll(Klass klass);

    @Delete("delete from klass where id = #{id}")
    public void deleteById(String id);

    @Insert("insert into klass(id,name,major) values(#{klass.id},#{klass.name},#{klass.major})")
    public void save(@Param("klass") Klass klass);

    @Update("update klass set name = #{klass.name},major = #{klass.major} where id = #{klass.id}")
    public void update(@Param("klass") Klass klass);

    @Select("select * from klass where id = #{id}")
    public Klass getReferenceById(String id);

    @Select("select * from klass where name like #{klass.name} or major = #{klass.major}")
    List<Klass> search(@Param("klass") Klass klass);
}
